﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TheHeGeoCommercial.News
{
    public partial class UcNewsDetail : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string rqString = Request["id"];
            if (!string.IsNullOrEmpty(rqString))
            {
                var newsId = Convert.ToInt32(rqString);
                using (var ent = new Dao.TheheGeoCommercialEntities())
                {
                    var newsObj = (from n in ent.TinTucs
                                   where n.id == newsId
                                   select n).FirstOrDefault();
                    if (newsObj != null)
                    {
                        lbTitle.Text = newsObj.NewsTitle;
                        lbShortView.Text = newsObj.ShortView;
                        Literal1.Text = newsObj.NewsContent;
                    }
                    else
                    {
                        Response.Redirect("~/News/News.aspx");
                    }
                        
                }
            }
        }
    }
}